#ifndef _GAME_STATE_H_
#define _GAME_STATE_H_

#include <Game/GameEvent.h>

namespace pp
{
    class GameState : public ne::State<Game>
    {
        public:
            explicit GameState(Game *pContent, const uint32_t id=ne::FINITE_STATE_MACHINE_DEFAULT_STATE_ID)
                : ne::State<Game>(pContent, id)
            {
            }

        protected:
            virtual uint32_t onEvent(ne::Event &event)
            {
                if (event.name == GAME_EVENT_NAME)
                {
                    return onEvent(dynamic_cast<GameEvent&>(event));
                }
                return mID;
            }

            virtual uint32_t onEvent(GameEvent &event)
            {
                if (event.ID == GAME_TICK_EVENT_ID)
                {
                    GameTickEvent& tickEvent = dynamic_cast<GameTickEvent&>(event);
                    return onTick(tickEvent.interval);
                }
                return mID;
            }

            virtual uint32_t onTick(const ne::real interval)
            {
                return mID;
            }
    };
}

#endif
